package day18;
import java.util.Scanner;

/**
 * 题目:统计每个月兔子的总数(查找规律可知考的是斐波那契数列)
 * https://www.nowcoder.com/practice/1221ec77125d4370833fd3ad5ba72395?tpId=37&&tqId=21260&rp=1&ru=/activity/oj&qru=/ta/huawei/question-ranking
 */
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int a = in.nextInt();
            System.out.println(func(a));
        }
    }

    public static int func(int m) {
        int first = 1;
        int second = 1;
        int num = 0;
        for(int i = 3;i <= m;i++) {
            num = first + second ;
            first = second;
            second = num;
        }
        return num;
    }
}